<template>
    <div>
        <p>展示vue指令----vue和元素dom操作的完美结合【拓展】</p>
        <p>{{msg}}</p>
        <input type="text" v-model="msg">
        <div id="demo" v-demo-directive:alert="msg"></div>
        <p>
            <router-link to="/article">
                sfad sfs ff sdfds adff d ff f af fa 去详情页
            </router-link>
        </p>
        \
        <p>
            <router-link to="/article">
                sfad sfs ff sdfds adff d ff f af fa 去详情页
            </router-link>
        </p>
        <p>
            <router-link to="/article">
                sfad sfs ff sdfds adff d ff f af fa 去详情页
            </router-link>
        </p>
        <p>
            <router-link to="/article">
                sfad sfs ff sdfds adff d ff f af fa 去详情页
            </router-link>
        </p>
        <p>
            <router-link to="/article">
                sfad sfs ff sdfds adff d ff f af fa 去详情页
            </router-link>
        </p>
        <p>
            <router-link to="/article">
                sfad sfs ff sdfds adff d ff f af fa 去详情页
            </router-link>
        </p>
        <p>
            <router-link to="/article">
                sfad sfs ff sdfds adff d ff f af fa 去详情页
            </router-link>
        </p>
        <p>
            <router-link to="/article">
                sfad sfs ff sdfds adff d ff f af fa 去详情页
            </router-link>
        </p>
        <p>
            <router-link to="/article">
                sfad sfs ff sdfds adff d ff f af fa 去详情页
            </router-link>
        </p>
        <p>
            <router-link to="/article">
                sfad sfs ff sdfds adff d ff f af fa 去详情页
            </router-link>
        </p>
        <p>
            <router-link to="/article">
                sfad sfs ff sdfds adff d ff f af fa 去详情页
            </router-link>
        </p>
        <p>
            <router-link to="/article">
                sfad sfs ff sdfds adff d ff f af fa 去详情页
            </router-link>
        </p>
    </div>
</template>
<script>
export default {
    data() {
            return {
                msg: 'hello!'
            }
        },
        directives: {
            demoDirective: {
                bind: function(el, binding, vnode) {
                    el.style.color = '#fff'
                    el.style.backgroundColor = 'blue';
                    el.innerHTML =
                        'name - ' + binding.name + '<br>' +
                        'expression - ' + binding.expression + '<br>' +
                        'argument - ' + binding.arg + '<br>' +
                        'value - ' + binding.value;
                    window.onscroll = function() {
                        console.log("-----------------------------滚动")
                    }
                },
                update: function(el, binding, vnode) {
                    el.innerHTML =
                        'name - ' + binding.name + '<br>' +
                        'expression - ' + binding.expression + '<br>' +
                        'argument - ' + binding.arg + '<br>' +
                        'value - ' + binding.value;
                   
                },
                unbind:function(){
                	 window.onscroll = null;
                }
            }
        }
}
</script>
